Clean up PeerConnections in these tests. Differential Revision: https://phabricator.services.mozilla.com/D79529 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1643058 gecko-commit: 4767df198c29cb1cd5c2c835a0b29267b9c8a106 gecko-integration-branch: autoland gecko-reviewers: jib 
diff --git a/webrtc/datachannel-emptystring.html b/webrtc/datachannel-emptystring.html index 6af436a..456bac7 100644 --- a/webrtc/datachannel-emptystring.html +++ b/webrtc/datachannel-emptystring.html 
@@ -76,8 +76,10 @@    test.step(function() {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());    gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());    gFirstConnection.onicecandidate = exchangeIce(gSecondConnection);  gSecondConnection.onicecandidate = exchangeIce(gFirstConnection); 
diff --git a/webrtc/getstats.html b/webrtc/getstats.html index 979e99c..0950a37 100644 --- a/webrtc/getstats.html +++ b/webrtc/getstats.html 
@@ -81,10 +81,12 @@  // This function starts the test.  test.step(function() {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());  gFirstConnection.onicecandidate = onIceCandidateToFirst;  gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange;    gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());  gSecondConnection.onicecandidate = onIceCandidateToSecond;    // The createDataChannel is necessary and sufficient to make 
diff --git a/webrtc/no-media-call.html b/webrtc/no-media-call.html index dbe6a0d..b1eba08 100644 --- a/webrtc/no-media-call.html +++ b/webrtc/no-media-call.html 
@@ -113,10 +113,12 @@  // This function starts the test.  test.step(function() {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());  gFirstConnection.onicecandidate = onIceCandidateToFirst;  gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange;    gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());  gSecondConnection.onicecandidate = onIceCandidateToSecond;  gSecondConnection.oniceconnectionstatechange = onIceConnectionStateChange;   
diff --git a/webrtc/promises-call.html b/webrtc/promises-call.html index ceb6ab2..8b9a275 100644 --- a/webrtc/promises-call.html +++ b/webrtc/promises-call.html 
@@ -66,10 +66,12 @@  // This function starts the test.  test.step(function() {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());  gFirstConnection.onicecandidate = onIceCandidateToFirst;  gFirstConnection.oniceconnectionstatechange = onIceConnectionStateChange;    gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());  gSecondConnection.onicecandidate = onIceCandidateToSecond;  gSecondConnection.oniceconnectionstatechange = onIceConnectionStateChange;   
diff --git a/webrtc/simplecall-no-ssrcs.https.html b/webrtc/simplecall-no-ssrcs.https.html index 87f8d93..5160451 100644 --- a/webrtc/simplecall-no-ssrcs.https.html +++ b/webrtc/simplecall-no-ssrcs.https.html 
@@ -32,6 +32,7 @@    function getNoiseStreamOkCallback(localStream) {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());  gFirstConnection.onicecandidate = onIceCandidateToFirst;  localStream.getTracks().forEach(function(track) {  gFirstConnection.addTrack(track, localStream); @@ -56,6 +57,7 @@    function receiveCall(offerSdp) {  gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());  gSecondConnection.onicecandidate = onIceCandidateToSecond;  gSecondConnection.ontrack = onRemoteTrack;   
diff --git a/webrtc/simplecall.https.html b/webrtc/simplecall.https.html index 291437a..ffe043b 100644 --- a/webrtc/simplecall.https.html +++ b/webrtc/simplecall.https.html 
@@ -32,6 +32,7 @@    function getNoiseStreamOkCallback(localStream) {  gFirstConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gFirstConnection.close());  gFirstConnection.onicecandidate = onIceCandidateToFirst;  localStream.getTracks().forEach(function(track) {  gFirstConnection.addTrack(track, localStream); @@ -52,6 +53,7 @@    function receiveCall(offerSdp) {  gSecondConnection = new RTCPeerConnection(null); + test.add_cleanup(() => gSecondConnection.close());  gSecondConnection.onicecandidate = onIceCandidateToSecond;  gSecondConnection.ontrack = onRemoteTrack;